package com.example.aircraftwar2024.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.aircraftwar2024.R;

public class OfflineActivity extends AppCompatActivity implements View.OnClickListener{

    static public enum GameMode{
        EASY,
        MEDIUM,
        HARD
    }
    private boolean music;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ActivityManager.getActivityManager().addActivity(this);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_offline);
        music = getIntent().getBooleanExtra("music",true);
        System.out.println("music is "+(music?"on":"off"));

        Button easyBtn = (Button) findViewById(R.id.easyBtn);
        Button normalBtn = (Button) findViewById(R.id.normalBtn);
        Button hardBtn = (Button) findViewById(R.id.hardBtn);

        easyBtn.setOnClickListener(this);
        normalBtn.setOnClickListener(this);
        hardBtn.setOnClickListener(this);

    }
    @Override
    public void onClick(View v){
        Intent intent = new Intent(OfflineActivity.this, GameActivity.class);
        if(v.getId() == R.id.easyBtn)
            intent.putExtra("gameType", GameMode.EASY.ordinal());
        else if(v.getId() == R.id.normalBtn)
            intent.putExtra("gameType", GameMode.MEDIUM.ordinal());
        else if(v.getId() == R.id.hardBtn)
            intent.putExtra("gameType", GameMode.HARD.ordinal());
        intent.putExtra("music", music);
        startActivity(intent);
    }

}